package com.hgy.carsb.controller;

import com.hgy.carsb.entity.UnitRatioDetail;
import com.hgy.carsb.service.SaleDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
public class UnitSaleController {

    @Autowired
    private SaleDetailService saleDetailService;

    private int year=2020;
    private int month=4;
    @GetMapping("/unitsale")
    public List<UnitRatioDetail> getUnitSale(){
        List<UnitRatioDetail> list = new ArrayList<>();
        list.add(saleDetailService.getSaleDetail(year, month, "FAW"));
        list.add(saleDetailService.getSaleDetail(year, month, "FAWTOYOTA"));
        list.add(saleDetailService.getSaleDetail(year, month, "FAWVOLKSWAGEN"));
        list.add(saleDetailService.getSaleDetail(year, month, "FAWMC"));
        list.add(saleDetailService.getSaleDetail(year, month, "FAWCARCO"));
        list.add(saleDetailService.getSaleDetail(year, month, "FAWJF"));
        list.add(saleDetailService.getSaleDetail(year, month, "FAWXL"));
        list.add(saleDetailService.getSaleDetail(year, month, "FAWKC"));
        list.add(saleDetailService.getSaleDetail(year, month, "FAWGM"));
        list.add(saleDetailService.getSaleDetail(year, month, "FAWHQ"));
        list.add(saleDetailService.getSaleDetail(year, month, "FAWHM"));
        return list;
    }
}
